package cn.neusoft.luofa603.yuejian_29.fragment;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.jude.rollviewpager.RollPagerView;
import java.util.ArrayList;
import java.util.List;
import cn.neusoft.luofa603.yuejian_29.adapter.RollPagerAdapter;
import cn.neusoft.luofa603.yuejian_29.R;
import cn.neusoft.luofa603.yuejian_29.adapter.TrainAdapter;
import cn.neusoft.luofa603.yuejian_29.adapter.TrainRollAdapter;

public class TrainingFragment extends Fragment {
    private View view;
    private TabLayout tabs;
    private ViewPager viewPager;
    private RollPagerView rollPV;
    private RecyclerView recyclerView;
    private List<String> mTitle = new ArrayList<String>();
    private List<Fragment> mFragment = new ArrayList<Fragment>();




    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        view = inflater.inflate(R.layout.training_fragment, container, false);
        rollPV = (RollPagerView) view.findViewById(R.id.rollPV);
        rollPV.setAdapter(new TrainRollAdapter(getActivity(), rollPV));
        initviews();
        initEvents();
        initData();
        TrainAdapter trainAdapter = new TrainAdapter(getChildFragmentManager(),mTitle,mFragment);
        viewPager.setAdapter(trainAdapter);
        tabs.setupWithViewPager(viewPager);
        return view;

    }
    public void initviews(){
        tabs = (TabLayout) view.findViewById(R.id.Training_tab);
        viewPager = (ViewPager) view.findViewById(R.id.CVP);

        mTitle.add("菜鸟");
        mTitle.add("入门");
        mTitle.add("进阶");
        mTitle.add("全部");
        mFragment.add(new CainiaoFragment());
        mFragment.add(new RumentFragment());
        mFragment.add(new JinjieFragment());
        mFragment.add(new QuanbuFragment());

}
    public void initEvents(){




    }
    public void initData(){

    }


}
